import Da from "element-ui/src/locale/lang/da";

/* 中国标准格式  转换 格式 */
export function chanceData (Data){
  let date = new Date(Data)
  let year = date.getFullYear();
  let month = date.getMonth() + 1;  // getMonth()返回值是0~11
  let day = date.getDate();
  let hour = date.getHours();
  let minute = date.getMinutes();
  let second = date.getSeconds();

  let result = year + "-" + (month < 10 ? "0" + month : month) + "-" + (day < 10 ? "0" + day : day) + " " + (hour < 10 ? "0" + hour : hour) + ":" + (minute < 10 ? "0" + minute : minute) + ":" + (second < 10 ? "0" + second : second);
  return result;
}


// 计算天数差
export function dataAbs(startData,endData){
  const data1 = new Date(startData)
  const data2 = new Date(endData)

  const differenceInMilliseconds = Math.abs(data1.getTime()-data2.getTime())

  return Math.ceil(differenceInMilliseconds/(1000*60*60*24))
}
